package com.duomizhibo.phonelive.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.duomizhibo.phonelive.AppContext;
import com.duomizhibo.phonelive.R;
import com.duomizhibo.phonelive.adapter.NewestAdapter;
import com.duomizhibo.phonelive.api.remote.ApiUtils;
import com.duomizhibo.phonelive.api.remote.PhoneLiveApi;
import com.duomizhibo.phonelive.base.AbsFragment;

import com.flyco.tablayout.SegmentTabLayout;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;
import okhttp3.Call;

/**
 * 首页最新直播
 */
public class ZhouBangFragment extends AbsFragment {

    SegmentTabLayout tabLayout_1;
    private String[] mTitles = {"日榜", "周榜","月榜", "总榜"};
    private ArrayList<Fragment> mFragments2 = new ArrayList<>();
    private View mDecorView;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_zhou, null);
        ButterKnife.inject(this, view);
        mDecorView = getActivity().getWindow().getDecorView();
//        tabLayout_1 = ViewFindUtils.find(mDecorView, R.id.tl_1);



        tabLayout_1 = (SegmentTabLayout) view.findViewById(R.id.tl_1);

//        tabLayout_1 =ViewFindUtils.find(mDecorView,R.id.tl_1);
        for (String title : mTitles) {
            mFragments2.add(SimpleCardFragment.getInstance("Switch Fragment " + title));
        }
        tabLayout_1.setTabData(mTitles, getActivity(), R.id.fl_change, mFragments2);
        return view;
    }




    @Override
    public void onResume() {
        super.onResume();

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        OkHttpUtils.getInstance().cancelTag("getNewestUserList");
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }


}
